# -*- coding: utf-8 -*-
# @date 2021/4/1 5:46 下午

import json
import socket

# 错误代码列表
ERRCD = {
    0: '解题成功',
    1: '解题结果初始化',
    -1: '解题模版等待支持',
    -99: '解题BUG',
}


class Config(object):
    """Config load from json file
    """

    def __init__(self, config=None, config_file=None):
        if config_file:
            with open(config_file) as fin:
                config = json.load(fin)
        self.config = config
        self.env = self._runtime_mode()

    @staticmethod
    def _runtime_mode():
        """判断运行环境是「开发」还是「生产」"""
        hostname = socket.gethostname()
        return 'dev' if hostname.find('MacBook') >= 0 else 'prod'


if __name__ == "__main__":
    pass
